﻿using Aspose.Words.Lists;
using Magicodes.ExporterAndImporter.Core;
using Microsoft.Extensions.Options;
using NP.BPMReportPlatform.Common;
using NP.BPMReportPlatform.Common.Dtos;
using SqlSugar;
using System;
using System.Collections;
using System.Collections.Generic;

namespace NP.BPMReportPlatform.Cadre.Dto
{
    /// <summary>
    /// 干部转身列表实体
    /// </summary>
    public class GetCadreResultInput : PagedAndSortedRequestDto
    {
        /// <summary>
        /// 主键
        /// </summary>
        [SugarColumn(IsPrimaryKey = true)]
        public string Id { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 工号
        /// </summary>
        public string WorkNumber { get; set; }

        /// <summary>
        /// 转身计划流程号
        /// </summary>
        public string PlanInstanceNumber { get; set; }

        /// <summary>
        /// 转身总结流程号
        /// </summary>
        public string ResultInstanceNumber { get; set; }

        /// <summary>
        /// 部门名称
        /// </summary>
        public string OrganizationName { get; set; }

        /// <summary>
        /// 职位
        /// </summary>
        public string ApplyerJob { get; set; }

        /// <summary>
        /// 职级
        /// </summary>
        public string ApplyerTitle { get; set; }

        /// <summary>
        /// 助力开始日期
        /// </summary>
        public DateTime? StartDate { get; set; }

        /// <summary>
        /// 助力期限
        /// </summary>
        public int? Month { get; set; }

        /// <summary>
        /// 助力结束日期
        /// </summary>
        public DateTime? EndDate { get; set; }

        /// <summary>
        /// 导师编号
        /// </summary>
        public string TeacherCode { get; set; }

        /// <summary>
        /// 导师姓名
        /// </summary>
        public string TeacherName { get; set; }

        /// <summary>
        /// 直接主管
        /// </summary>
        public string LeaderCode { get; set; }

        /// <summary>
        /// 直接主管
        /// </summary>
        public string LeaderName { get; set; }

        /// <summary>
        /// 是否抄送直接主管
        /// </summary>
        public bool IsCCLeader { get; set; }

        /// <summary>
        /// 转身状态
        /// </summary>
        public int? Status { get; set; }

        /// <summary>
        /// 转身状态结果
        /// </summary>
        public string StatusName { get; set; }

        /// <summary>
        /// 创建日期
        /// </summary>
        public DateTime? CreateTime { get; set; }
    }

    /// <summary>
    /// 报表查询条件
    /// </summary>
    public class CadreReportSearchDto : PagedAndSortedRequestDto
    {
        /// <summary>
        /// 关键字
        /// </summary>
        public string KeyWord { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        public string StartDate { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        public string EndDate { get; set; }

        /// <summary>
        /// 报表类型
        /// </summary>
        public int ReportType { get; set; }

        /// <summary>
        /// 是否导出
        /// </summary>
        public bool IsExport { get; set; }
    }

    /// <summary>
    /// 导师培训次数导出
    /// </summary>
    public class CadreReportTeacherOutPut
    {
        [ExporterHeader("导师工号")]
        public string TeacherCode { get; set; }
        [ExporterHeader("导师姓名")]
        public string TeacherName { get; set; }
        [ExporterHeader("所属组织")]
        public string OrgName { get; set; }
        [ExporterHeader("岗位")]
        public string Posnc { get; set; }
        [ExporterHeader("担任导师次数")]
        public int TeacherCount { get; set; }
    }

    /// <summary>
    /// 转身执行统计表（导出用）
    /// </summary>
    public class CadreReportOrgCountOutPut : ITreeNode
    {
        [ExporterHeader(IsIgnore = true)]
        public string id { get; set; }

        [ExporterHeader(IsIgnore = true)]
        public string ParentOrgCode { get; set; }

        [ExporterHeader(IsIgnore = true)]
        public string OrgName { get; set; }

        [ExporterHeader(IsIgnore = true)]
        public string FullPathText { get; set; }

        [ExporterHeader("一级组织名称")]
        public string OrgName1 { get; set; }

        [ExporterHeader("二级组织名称")]
        public string OrgName2 { get; set; }

        [ExporterHeader("三级组织名称")]
        public string OrgName3 { get; set; }

        [ExporterHeader("四级组织名称")]
        public string OrgName4 { get; set; }

        [ExporterHeader("五级组织名称")]
        public string OrgName5 { get; set; }

        [ExporterHeader("六级组织名称")]
        public string OrgName6 { get; set; }

        [ExporterHeader("七级组织名称")]
        public string OrgName7 { get; set; }

        [ExporterHeader("八级组织名称")]
        public string OrgName8 { get; set; }

        [ExporterHeader("启动人次")]
        public int CadreCount { get; set; }

        /// <summary>
        /// 进行中人数
        /// </summary>
        [ExporterHeader("进行中人数")]
        public int UsingCount { get; set; }

        /// <summary>
        /// 考核通过人数
        /// </summary>
        [ExporterHeader("考核通过人数")]
        public int ApprovedCount { get; set; }

        /// <summary>
        /// 考核待定人数
        /// </summary>
        [ExporterHeader("考核待定人数 ")]
        public int PendingCount { get; set; }

        /// <summary>
        /// 考核不通过人数
        /// </summary>
        [ExporterHeader("考核不通过人数 ")]
        public int UnApprovedCount { get; set; }

        /// <summary>
        /// 终止人数
        /// </summary>
        [ExporterHeader("终止人数 ")]
        public int EndCount { get; set; }

        /// <summary>
        /// 考核通过、待定、不通过人数下辅导次数>=3次的人数，反之为0
        /// </summary>
        [ExporterHeader("过程辅导达标人数")]
        public int TeacherRecordCount { get; set; }

        /// <summary>
        /// 过程辅导达标率
        /// [TeacherRecordCount/(ApprovedCount+PendingCount+UnApprovedCount)]*100%
        /// </summary>
        [ExporterHeader("过程辅导达标率")]
        public string ApprovePencent { get; set; } = "0%";

        [ExporterHeader(IsIgnore = true)]
        public List<CadreReportOrgCountOutPut> childs { get; set; }

        public string GetId()
        {
            return id;
        }

        public string GetPid()
        {
            return ParentOrgCode;
        }

        public void SetChildren(IList children)
        {
            childs = (List<CadreReportOrgCountOutPut>)children;
        }
    }



    /// <summary>
    /// 上岗前沟通记录
    /// </summary>
    public class CadreReportRecord
    {
        [ExporterHeader("干部工号")]
        public string WorkNumber { get; set; }
        [ExporterHeader("干部姓名")]
        public string UserName { get; set; }
        [ExporterHeader("所属部门")]
        public string OrgName { get; set; }
        [ExporterHeader("助力开始时间")]
        public string StartDate { get; set; }
        [ExporterHeader("助力结束时间")]
        public string EndDate { get; set; }
        [ExporterHeader("最重要的工作")]
        public string Record1 { get; set; }
        [ExporterHeader("主管未来期望")]
        public string Record2 { get; set; }
        [ExporterHeader("快速提升内容")]
        public string Record3 { get; set; }
        [ExporterHeader("近期工作")]
        public string Record4 { get; set; }
    }

    /// <summary>
    /// 导师辅导记录表
    /// </summary>
    public class CadreReportTeacherRecord
    {
        [ExporterHeader("干部工号")]
        public string WorkNumber { get; set; }
        [ExporterHeader("干部姓名")]
        public string UserName { get; set; }
        [ExporterHeader("所属部门")]
        public string OrgName { get; set; }
        [ExporterHeader("导师")]
        public string TeacherName { get; set; }
        [ExporterHeader("沟通次数")]
        public int TalkCount { get; set; }
        [ExporterHeader("沟通辅导日期")]
        public string TalkDate { get; set; }
        [ExporterHeader("辅导沟通纪要")]
        public string TalkResult { get; set; }
    }

    /// <summary>
    /// 转身述职记录表
    /// </summary>
    public class CadreReportResult
    {
        [ExporterHeader("干部工号")]
        public string WorkNumber { get; set; }

        [ExporterHeader("干部姓名")]
        public string UserName { get; set; }

        [ExporterHeader("所属部门")]
        public string OrganizationName { get; set; }

        [ExporterHeader("岗位")]
        public string ApplyerJob { get; set; }

        [ExporterHeader("职级")]
        public string ApplyerTitle { get; set; }

        [ExporterHeader("导师")]
        public string TeacherName { get; set; }

        [ExporterHeader("直接主管")]
        public string LeaderName { get; set; }

        [ExporterHeader("述职日期")]
        public string RegularDate { get; set; }

        [ExporterHeader("述职结果")]
        public string RegularResult { get; set; }

        [ExporterHeader("发展规划或使用建议")]
        public string RegularSuggest { get; set; }

        [ExporterHeader("待定原因")]
        public string RegularPendingReason { get; set; }
    }

    /// <summary>
    /// 转身计划总结报表
    /// </summary>
    public class CadreReportProcess
    {
        [ExporterHeader("干部工号")]
        public string WorkNumber { get; set; }

        [ExporterHeader("干部姓名")]
        public string UserName { get; set; }

        [ExporterHeader("所属部门")]
        public string OrgName { get; set; }

        [ExporterHeader("计划制定流程号")]
        public string PlanInstanceNumber { get; set; }

        [ExporterHeader("计划总结流程号")]
        public string ResultInstanceNumber { get; set; }

        [ExporterHeader("序号")]
        public int KeyIndex { get; set; }

        [ExporterHeader("行动计划")]
        public string Plan { get; set; }

        [ExporterHeader("衡量标准")]
        public string Measure { get; set; }

        [ExporterHeader("所需支持人")]
        public string NeedUser { get; set; }

        [ExporterHeader("计划完成时间")]
        public string FinishDate { get; set; }

        [ExporterHeader("总结")]
        public string Result { get; set; }
    }
}
